export const getFormConfig = (type, configData) => {
    switch (type) {
        case 'date':
            return {
                formItems: [
                    { component: 'input', pattern: 'simple', name: 'format', label: '格式化', span: 8, options: {} },
                    { component: 'input', pattern: 'simple', name: 'dateFieldName', label: '日期字段名',  span: 8,options:{}},
                ]
            }
            break;
            case 'seq':
                return {
                    formItems: [
                        { component: 'input', pattern: 'simple', name: 'format', label: '格式化', span: 8, options: {} },
                        { component: 'input', pattern: 'simple', name: 'condition', label: '条件', span: 8, options: {} },
                        { component: 'inputNumber', pattern: 'simple', name: 'length', label: '长度', span: 8, options: { min: 0 } },
                        { component: 'input', pattern: 'simple', name: 'min', label: '最小值', span: 8, options: { min: 0 } },
                        { component: 'input', pattern: 'simple', name: 'max', label: '最大值', span: 8, options: { min: 0 } },
                        { component: 'codeEditor', name: 'maxNoSql', label: '取得最长编号sql语句', span: 24, options: { height:50} }
                    ]
                }
            break;
            case 'fixValue':
                return {
                    formItems: [
                        { component: 'input', pattern: 'simple', name: 'value', label: '表达式', span: 8, options: {} },
                        { component: 'input', pattern: 'simple', name: 'condition', label: '条件', span: 8, options: {} },
                    ]
                }
            break;
            case 'random':
                return {
                    formItems: [
                        { component: 'inputNumber', pattern: 'simple', name: 'length', label: '长度', span: 8, options: { min: 0 } },
                        { component: 'select', name: 'source', label: '随机数源类型', span: 8, options: { items: configData.sourceList } },
                       
                    ]
                }
            break;
    }
}
export const getValidatorFormConfig = (type,configData)=>{
    switch (type) {
        case 'required': case 'email': case 'idCard': case 'integer': case 'number': case'phone': case 'tel': case 'positiveInteger': case 'positiveNumber' : case 'unique':
            return {
                formItems: [
                    { component: 'switchv', name: 'required', label: '是否必填', span: 6, options: {} },
                    { component: 'input', pattern: 'simple', name: 'type', label: 'type类型', span: 6, options: {} },
                ]
            }
            break;
            case 'beetl': case 'spel':
                return {
                    formItems: [
                        { component: 'switchv', name: 'required', label: '是否必填', span: 6, options: {} },
                        { component: 'input', pattern: 'simple', name: 'type', label: 'type类型', span: 6, options: {} },
                        { component: 'input', pattern: 'simple', name: 'express', label: '表达式', span: 12, options: {} },
                    ]
                }
            break;
            case 'between':
                return {
                    formItems: [
                        { component: 'switchv', name: 'required', label: '是否必填', span: 6, options: {} },
                        { component: 'input', pattern: 'simple', name: 'type', label: 'type类型', span: 6, options: {} },
                        { component: 'input', pattern: 'simple', name: 'min', label: '最小值', span: 6, options: { } },
                        { component: 'input', pattern: 'simple', name: 'max', label: '最大值', span: 6, options: { } },
                    ]
                }
            break;
            case 'equla':
                return {
                    formItems: [
                        { component: 'switchv', name: 'required', label: '是否必填', span: 6, options: {} },
                        { component: 'input', pattern: 'simple', name: 'type', label: 'type类型', span: 6, options: {} },
                        { component: 'inputNumber', pattern: 'simple', name: 'equla', label: '相等值', span: 6, options: { } },
                    ]
                }
            break;
            case 'length':
                return {
                    formItems: [
                        { component: 'switchv', name: 'required', label: '是否必填', span: 6, options: {} },
                        { component: 'input', pattern: 'simple', name: 'type', label: 'type类型', span: 6, options: {} },
                       
                    ]
                }
            break;
            case 'max':
                return {
                    formItems: [
                        { component: 'switchv', name: 'required', label: '是否必填', span: 6, options: {} },
                        { component: 'input', pattern: 'simple', name: 'type', label: 'type类型', span: 6, options: {} },
                        { component: 'input', pattern: 'simple', name: 'max', label: '最大值', span: 6, options: { } },
                    ]
                }
            break;
            case 'min':
                return {
                    formItems: [
                        { component: 'switchv', name: 'required', label: '是否必填', span: 6, options: {} },
                        { component: 'input', pattern: 'simple', name: 'type', label: 'type类型', span: 6, options: {} },
                        { component: 'input', pattern: 'simple', name: 'min', label: '最小值', span: 6, options: { } },
                    ]
                }
            break;
            case 'pattern':
                return {
                    formItems: [
                        { component: 'switchv', name: 'required', label: '是否必填', span: 6, options: {} },
                        { component: 'input', pattern: 'simple', name: 'type', label: 'type类型', span: 6, options: {} },
                        { component: 'input', pattern: 'simple', name: 'pattern', label: '正则表达式', span: 12, options: { } },
                    ]
                }
            break;
            case 'sql':
                return {
                    formItems: [
                        { component: 'input', pattern: 'simple', name: 'express', label: '表达式', span: 12, options: {} },
                        { component: 'codeEditor', name: 'sql', label: 'sql语句', span: 12, options: { height:100} },
                        { component: 'switchv', name: 'required', label: '是否必填', span: 6, options: {} },
                        { component: 'input', pattern: 'simple', name: 'type', label: 'type类型', span: 6, options: {} }
                    ]
                }
            break;
    }
}